﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AiXiu.BLL;
using AiXiu.Model;

namespace AiXiu.WebSite
{
    public partial class Play : System.Web.UI.Page
    {
        public string VideoId;
        public int UserId;
        public TBVideos Video;
        public TBUsers Author;
        public GetPlayInfoResult playInfo;
        public bool IsLike;
        public long LikeCount;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.VideoId = Request.QueryString["videoId"];
                TBUsers user = IdentityManager.ReadUser();
                this.UserId = user.Id;
                //// 获取发布者信息
                VideoBLL videoBLL = new VideoBLL();
                this.Video = videoBLL.GetVideoByVideoId(this.VideoId);
                this.Author = Video.TBUsers;
                // 获取播放地址
                this.playInfo = videoBLL.InitPlay(this.VideoId);
                // 点赞
                LikeManger likeManager = new LikeManger();
                this.IsLike = likeManager.IsLike(VideoId, UserId);
                this.LikeCount = likeManager.Count(VideoId);
            }
        }  
    }
}